package huaweiod.second;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * 找出作弊的人
 * https://renjie.blog.csdn.net/article/details/134532479
 */
public class C4_FindCheatPeople {

    static class Employee {
        public int id;
        public int score;

        public Employee(int id, int score) {
            this.id = id;
            this.score = score;
        }
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int count = in.nextInt();
        List<Employee> list = new ArrayList<>();
        for (int i = 0; i < count; i++) {
            int id = in.nextInt();
            int score = in.nextInt();
            list.add(new Employee(id, score));
        }
        list.sort(((o1, o2) -> o1.score - o2.score));
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < list.size() - 1; i++) {
            min = Math.min(min, list.get(i + 1).score - list.get(i).score);
        }
        // 得考虑min = 0的情况
        list.sort(((o1, o2) -> o1.id - o2.id));
        for (int i = 0; i < list.size() - 1; i++) {
            if (list.get(i + 1).score - list.get(i).score == min) {
                System.out.println(list.get(i).id + " " + list.get(i + 1).id);
            }
        }
    }
}
